{extend name="public:_base" /}
{block name="js"}
{include file="public/_validform"}

<script>
    $(function () {
        $("[name='pid']").find("[value='{$data.pid ?? ''}']").attr("selected", true);
        $("[name='nav_type']").find("[value='{$data.link ?? 'http://'}']").attr("selected", true);
        $('#select').change(function(){
            var ss = $(this).children('option:selected').val();
            $('.formControls').find('#link').attr('value', ss);
        });

        $('#pid').change(function(){
            var ss = $(this).children('option:selected').attr('id');
            $('#pids').attr('value', ss);
        });
    });
</script>
{/block}
{block name="main"}
<div class="page-container">

    <form action="{:url('Nav/save')}" method="post" class="form form-horizontal"
          id="form">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">
                <span class="c-red">*</span>
                导航级别：</label>
            <div class="formControls col-xs-9 col-sm-9">
                <select name="pid" id="pid" class="select">
                    <option value="0" id=",">一级</option>
                    {volist name="getall" id="vo"}
                    <option value="{$vo.id}"  id="{$vo.pids}">{$vo['level']}{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">
                <span class="c-red">*</span>
                导航名：</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="text" class="input-text" value="{$data.name ?? ''}" placeholder="" datatype="*"
                       name="name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">
                <span class="c-red">*</span>英文名：</label>
            <div class="formControls col-xs-9 col-sm-9">
                <input type="text" class="input-text" value="{$data.Ename ?? ''}" placeholder="" datatype="*"
                       name="Ename">
            </div>
        </div>

        <div class="row cl">
            <div class="col-9 col-offset-2">
                <input name="id" value="{$data.id ?? ''}" type="hidden">
                <input name="type" value="contact" type="hidden">
                <input name="model" value="contact" type="hidden">
                <input name="action" value="edit" type="hidden">
                <input name="link" value="Contact" type="hidden">
                <input id="pids" name="pids" value="{$data.pids ?? ','}" type="hidden">
                {:token()}
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</div>
{/block}
